<!--推荐内容代码-->
<template>
  <div class="tuijian">
    <h2 class="hometitle"><span><a href="/">模板分享</a><a href="/">学无止境</a><a href="/">慢生活</a><a href="/">热门标签</a></span>特别推荐</h2>
    <ul>
      <li v-for="(item,index) in recommends" :key="index">
        <div class="tpic"><img :src="getImg(item.img)"></div>
        <b>{{ item.title }}</b>
        <span>{{ item.content }}</span>
        <a href="#" @click="topicInfo(item.id)" class="readmore">阅读原文</a></li>
    </ul>
  </div>
</template>

<script>
    export default {
        name: "Recommend",
      props:{
        recommend:Array
      },
      mounted() {
          this.recommends = this.recommend;
      },
      data(){
          return{
            recommends:[]
          }
      },
      methods:{
        topicInfo(blogId){
          let routeData = this.$router.resolve({ path: `/common/TopicInfo`,query:{id:blogId}});
          window.open(routeData.href, '_blank');
        },
        getImg(img){
          return process.env.IMG_URL + "/img/"+img;
        }
      }
    }
</script>

<style scoped>

</style>
